﻿@using Domain.Entity
@model Domain.Entity.Account



<div id="titlelessItem">
    <div class="item" style="height: 290px;">
        <div style="float: left; width: 30%;">
            <h2>@Html.Label("Name")</h2>
            <div class="descBox descBlack">@Html.DisplayFor(x => x.FirstName) @Html.DisplayFor(x => x.LastName)</div><br/>
            <h2>@Html.Label("Role")</h2>

            <div class="descBox descBlack">
            @foreach (String role in @Roles.GetRolesForUser(@Model.Username))
            {
                  <h3>@role</h3>   
            }</div><br/>
        
            <h2>@Html.LabelFor(x => x.DateOfBirth)</h2>
            <div class="descBox descBlack">@Model.DateOfBirth.Month/@Model.DateOfBirth.Day/@Model.DateOfBirth.Year</div>
        </div>
        <div style="float: right; width:55%;">
            <h2>@Html.Label("Email")</h2>
            <div class="descBox descBlack">@Membership.GetUser(Model.Username).Email</div><br/>       
            <h2>@Html.Label("Joined On ") </h2>
            <div class="descBox descBlack">@Membership.GetUser(Model.Username).CreationDate</div><br/>
            <h2>@Html.Label("Last Visit On ")</h2> 
            <div class="descBox descBlack">@Membership.GetUser(Model.Username).LastActivityDate</div><br/>
            
            @if (User.Identity.Name.Equals(Model.Username))
            {
                <div >
                    @Html.ActionLink("Change Password", "ChangePassword", "Account", null, new { @class="actionButtons " + @Html.GetColor(Request.Cookies["color"])})<br/><br/>
                    @Html.ActionLink("Change Information", "ChangeUserInformation", "Account", null, new { @class = "actionButtons " + @Html.GetColor(Request.Cookies["color"]) })
                </div>
            }
        </div>
    </div>
    <div class="item">
        <h2 class="title @Model.LayoutColor">Created Reviews</h2>
        <table style="text-align: center;width: 100%;" class="defaultGrey">
            <tr class="tHeader @Model.LayoutColor">
                <th>Name</th>
                <th>Description</th>
                <th>Number of Posts</th>
            </tr>
            @foreach (Review r in @Model.UserReviews)
            {
                <tr>
                    <td>@Html.ActionLink(r.Name, "ReviewInfo", "Review", new {id = r.Id}, null)</td>
                    <td>@r.Summary</td>
                    <td>@r.Feedbacks.Count</td>
                </tr>
            }
        </table>
        <br/>
    </div>
    <div class="item">
        <h2 class="title @Model.LayoutColor">Posted Feedback</h2>
        <table style="text-align: center; width: 100%" class="defaultGrey">
            <tr class="tHeader @Model.LayoutColor">
                <th>Posted On</th>
                <th>Comment</th>
                <th>Posted Date</th>
            </tr>
            @foreach(Feedback f in @Model.UserFeedback)
            {
                <tr>
                    <td>@Html.ActionLink(f.Review.Name, "ReviewInfo", "Review", new {id = f.Review.Id}, null)</td>
                    <td>@f.Message</td>
                    <td>@f.PostedDate</td>
                </tr>
            }
        </table>
        <br/>
    </div>
</div>
